#!/usr/bin/env python
#
#   Copyright (C) 2006 by Patrick Stinson and Jonathan Saggau             
#   patrickkidd@gmail.com   saggau@gmail.com                              
#                                                                         
#   This program is free software; you can redistribute it and/or modify  
#   it under the terms of the GNU General Public License as published by  
#   the Free Software Foundation; either version 2 of the License, or     
#   (at your option) any later version.                                   
#                                                                         
#   This program is distributed in the hope that it will be useful,       
#   but WITHOUT ANY WARRANTY; without even the implied warranty of        
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         
#   GNU General Public License for more details.                          
#                                                                         
#   You should have received a copy of the GNU General Public License     
#   along with this program; if not, write to the                         
#   Free Software Foundation, Inc.,                                       
#   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  
#
import unittest
from supyrconductor import buffer

class BufferTest(unittest.TestCase):

    def setUp(self):
        pass
        
    def test_commands(self):
        self.assertEqual(buffer.alloc(1, 1024, 2), ['/b_alloc', 1, 1024, 2])
        self.assertEqual(buffer.allocRead(1, "/Users/jonathan/fake.wav", 0,\
                                          1024), 
                        ['/b_allocRead', 1, "/Users/jonathan/fake.wav", 0, \
                         1024])
        self.assertEqual(buffer.close(1), ['/b_close', 1])
        self.assertEqual(buffer.fill(1, {1:[12,1000], 13:[12,1400]}),
                         ['/b_fill', 1, 1, 12, 1000, 13, 12, 1400])
        self.assertEqual(buffer.free(1), ['/b_free', 1])
        self.assertEqual(buffer.get(1, (120, 121, 122)), 
                         ['/b_get', 1, 120, 121, 122])
        self.assertEqual(buffer.getn(1, {120:5, 130:5, 140:5}), 
                         ['/b_getn', 1, 120, 5, 130, 5, 140, 5])
#         buffer_query
#         buffer_read
#         buffer_set
#         buffer_setn
#         buffer_write
#         buffer_zero
        pass
        
    def test_object(self):
        pass
        
if __name__ == '__main__':
    unittest.main()